<?php
use yii\web\View;
use yii\widgets\ActiveForm;
use yii\widgets\Breadcrumbs;
use app\modules\core\models\Field;
use app\modules\core\widgets\SlideNav;

?>
<div class="container-fluid">
	<div class="row">
        <?= SlideNav::widget() ?>

		<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 col-lg-10 col-lg-offset-2 main">
            <?= Breadcrumbs::widget([
                'homeLink' => ['label' => 'HOME', 'url' => '/core'],
                'links' => [
                    ['label' => '模型', 'url' => '/core/model/list'],
                    '编辑',
                ]
            ]) ?>
			
			<div class="row">
				<div class="col-md-12 col-lg-12">
					<div class="alert alert-warning" role="alert">
						 <button type="button" class="close" data-dismiss="alert">×</button>
						 <strong>警告!</strong> 请注意你的个人隐私安全.
					</div>
                        <?php
                            $form = ActiveForm::begin(
                                [
                                    'options' => ['class' => 'form-horizontal'],
                                    'method' => 'POST',
                                    'fieldConfig' => [
                                        'labelOptions' => ['class' => 'col-md-1 control-label'],
                                        'template' => '{label}<div class="col-md-3 controls">{input}</div>{hint}{error}',
                                    ],
                                ]
                            );
                        
                            echo $form->field($field, 'id')->textInput();
                            echo $form->field($field, 'type')->dropDownList(Field::$fieldTypes);
                            echo $form->field($field, 'name')->textInput();
                            echo $form->field($field, 'desc')->textInput();
                            echo $form->field($field, 'view')->dropDownList(Field::$viewList);
                            echo $form->field($field, 'required')->radioList(Field::$requiredList);
                            echo $form->field($field, 'sourceType')->dropDownList(Field::$stypes);
                            echo $form->field($field, 'source')->textInput();
                            echo $form->field($field, 'validates')->checkboxList($validators);
                            // echo $form->field($field, 'filters')->checkboxList([]);
                        ?>
                        <div class="form-group">
                        	<div class="col-md-12 controls">
                                <a type="button" class="btn btn-primary" href="/core/model/info?id=<?= $model->id ?>">取消</a>
                                <button type="submit" class="btn btn-primary">提交</button>
                        	</div>
                        </div>
                    <?php ActiveForm::end(); ?>
				</div>
			</div>
		</div>
	</div>
</div>

